all:
	if [ -f openembedded/conf/machine/hsc200.conf ]; then \
		echo "The system has been initialized already"; \
		exit; \
	fi
	make init
init:
	wget http://download.berlios.de/bitbake/bitbake-1.8.18.tar.gz
	tar xzvf bitbake-1.8.18.tar.gz
	ln -s bitbake-1.8.18 bitbake
	git clone git://git.openembedded.org/openembedded
	cd openembedded; git checkout origin/stable/2009
	cp -a openembedded.patch/* openembedded
	patch -p1 < hsc200.patch
	echo "Please use 'bitbake hsc200-image' to build the system. Remember to 'source build_source' to initialize the environment variables"

rootfs:
	mkdir -p root
	-tar -C root -xvf tmp/deploy/images/hsc200-image-hsc200.tar
	-tar -C root -xzvf kernel.tgz
	mkfs.cramfs root hsc200.fw

